package com.briup.mt.service.impl;

import com.briup.mt.bean.Comment;

import com.briup.mt.bean.CommentExample;
import com.briup.mt.bean.DatasetFile;
import com.briup.mt.bean.DatasetFileExample;
import com.briup.mt.dao.CommentMapper;
import com.briup.mt.service.ICmsCommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import java.util.List;

/**
 * @author pete
 * @version 1.0
 * @date 2020/12/16 11:38
 */
@Service
public class CmsCommentServiceImpl implements ICmsCommentService {
    @Autowired
    private CommentMapper commentMapper;

    @Override
    public List<Comment> query(String status){
        CommentExample example = new CommentExample();
        List<Comment> list= commentMapper.selectByExample(example);
        return list;
    }

    @Override
    public void saveOrUpdate(Comment comment){
        if (comment.getId() == null) {
            commentMapper.insert(comment);
        }else{
            commentMapper.updateByPrimaryKey(comment);
        }
    }

    @Override
    public void deleteById(Long id) {

        commentMapper.deleteByPrimaryKey(id);
    }

}

